<template>
  <el-dialog
    width="30%"
    :title="$t('m.shelves.appoint')"
    :visible.sync="dialogVisible"
    :before-close="close"
  >
    <el-form ref="form" size="mini" :model="form" label-width="120px">
      <el-row>
        <el-col :span="20">
          <el-form-item :label="$t('m.charge')">
            <el-select v-model="form.taskleader" :placeholder="$t('m.choose')+$t('m.charge')" filterable>
              <el-option
                v-for="(item,index) in options"
                :key="index"
                :label="item.username"
                :value="item.userid"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-row>
      <el-button size="mini" @click="close">{{$t('m.cancel')}}</el-button>
      <el-button size="mini" type="primary" @click="save(form.taskleader)">{{$t('m.save')}}</el-button>
    </el-row>
  </el-dialog>
</template>
<script>
export default {
  name:'assign',
  props:['dialogVisible', 'options'],
  data(){
    return {
      form:{
        taskleader:''
      }
    }
  },
  methods:{
    close(){
      this.form.taskleader = ''
      this.$emit('close')
    },
    save(taskleader){
      this.$emit('save', taskleader)
    }
  }
}
</script>
<style scoped>
.el-select-dropdown__item{
  text-transform: none;
}
</style>